package com.spc.redis.configurer;

import com.spc.redis.RedisHighClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author alex
 * @version v1.0 2021/3/18
 */
@Configuration
@EnableConfigurationProperties({RedisClientProperties.class})
public class RedisClientAutoConfiguration {

    private final RedisClientProperties redisClientProperties;

    private final RedisTemplate<String, String> redisTemplate;

    public RedisClientAutoConfiguration(RedisClientProperties redisClientProperties, RedisTemplate<String, String> redisTemplate) {
        this.redisClientProperties = redisClientProperties;
        this.redisTemplate = redisTemplate;
    }


    @Bean
    RedisHighClient redisHighClient() {
        return new RedisHighClient(redisTemplate, redisClientProperties);
    }




}
